<template>
    <div class="edu-page-warp">
        <ConditionCard
            shadow="never"
            body-style="padding: 24px 24px 6px 24px;"
            @search="onSubmit"
            @reset="reset('queryForm')"
        >
            <el-form ref="queryForm" :model="queryForm" label-position="right" label-width="90px">
                <el-row :gutter="24" style="height: 50px;">
                    <!-- <el-col :span="6">
                        <el-form-item label="管理部门:" prop="projId">
                            <el-select
                                v-model="queryForm.projId"
                                style="width: 100%"
                                @change="handleChange"
                            >
                                <el-option
                                    v-for="item in options.project"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>-->
                    <el-col :span="8">
                        <el-form-item label="年级:" prop="grade"
                        :error="(queryForm.projId=='1' && !queryForm.grade && !!queryForm.faculty) ? $t('culture.rules.plsChooseGrade'):''"
                        >
                            <el-date-picker
                                v-model="queryForm.grade"
                                value-format="yyyy"
                                type="year"
                                placeholder="选择学年"
                                style="width: 100%"
                                @change="(queryForm.projId=='1') ? queryCampusMajor() : ''"
                            />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="培养层次:" prop="trainingLevel">
                            <el-select v-model="queryForm.trainingLevel" style="width: 100%" clearable>
                                <el-option
                                    v-for="item in options.trainingLevel"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="审核状态:" prop="status">
                            <el-select v-model="queryForm.status" style="width: 100%" clearable>
                                <el-option
                                    v-for="item in options.status"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col v-if="queryForm.projId == '1'" :span="8">
                        <el-form-item label="类别:" prop="professionCateGory">
                            <el-select v-model="queryForm.professionCateGory" style="width: 100%;" clearable>
                                <el-option
                                    v-for="item in options.professionCateGory"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" v-if="queryForm.projId != '1'">
                        <el-form-item :label="$t('culture.scheme.degreeType') + ':'">
                            <el-select v-model="queryForm.degreeType" clearable style="width: 100%;"
                                @change="(queryForm.projId != '1') ? queryCampusMajor() :''">
                                <el-option
                                    v-for="item in options.degreeType"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                ></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="学院:" prop="faculty" style="height:32px;">
                            <el-select
                                v-model="queryForm.faculty"
                                filterable 
                                clearable
                                style="width: 100%"
                                @change="queryCampusMajor"
                            >
                                <el-option
                                    v-for="item in options.faculty"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <template v-if="queryForm.projId == '1'">
                        <el-col :span="8">
                            <el-form-item filterable label="校内专业:" prop="campusProfession">
                                <el-select v-model="queryForm.campusProfession" style="width: 100%" clearable>
                                    <el-option
                                        v-for="item in options.campusProfessions"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value"
                                    />
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </template>
                    <template v-else>
                        <el-col :span="8">
                            <el-form-item filterable label="专业:" prop="major">
                                <el-select v-model="queryForm.major" style="width: 100%" clearable>
                                    <el-option
                                        v-for="item in options.major"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value"
                                    />
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="学习形式:" prop="formLearning">
                                <el-select
                                    v-model="queryForm.formLearning"
                                    style="width: 100%"
                                    clearable
                                >
                                    <el-option
                                        v-for="item in options.formLearning"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value"
                                    />
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="培养类别:" prop="trainingCategory">
                                <el-select
                                    v-model="queryForm.trainingCategory"
                                    style="width: 100%"
                                    clearable multiple collapse-tags
                                >
                                    <el-option
                                        v-for="item in options.trainingCategory"
                                        :key="item.code"
                                        :label="item.name"
                                        :value="item.code"
                                    />
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </template>
                </el-row>
            </el-form>
        </ConditionCard>
        <el-card shadow="never" body-style="padding: 24px;" class="card-margin">
            <h1 class="condition-title">{{ $t('common.text.list') }}</h1>
            <div class="div-main clearfix">
                <div class="float-left">
                    <el-input
                        v-model="queryForm.name"
                        placeholder="培养方案名称"
                        prefix-icon="el-icon-search"
                        @change="handSearchChang"
                    />
                </div>
                <div class="float-left" v-if="role == 3">
                    <p style="color:red;margin-left:50px;font-size:18px">
                        培养方案维护开放时间：{{startTime}}——{{endTime}}
                    </p>
                </div>
                <div class="float-right">
                    <el-button @click="exportPage"
                    >{{ $t('common.btn.pageExport') }}</el-button>
                    <el-button v-if="showOperateButton && role == 4" @click="copy">复制</el-button>
                    <el-button
                        v-if="'1'!==queryForm.projId && showOperateButton && role == 4" 
                        @click="handleBatchCreateSchemes"
                    >{{ $t('common.btn.batch') + $t('common.btn.add') }}</el-button>
                    <el-button @click="handleExportSchemes('cn')">{{ '方案'+$t('common.btn.export') + ' (中文)'}}</el-button>
                    <el-button @click="handleExportSchemes('en')">{{ '方案'+$t('common.btn.export') + ' (英文)'}}</el-button>
                    <el-button v-if="showOperateButton && role == 4" @click="handleDeleteSchemes">{{ $t('common.btn.delete') }}</el-button>
                    <el-button v-if="showOperateButton && role == 4" 
                        type="primary"
                        @click="addCultrueScheme(true)"
                    >{{ $t('common.btn.add') }}</el-button>
                </div>
            </div>
            <el-table
                :data="tableData"
                stripe
                style="width: 100%"
                @select="selectRow"
                @selection-change="selectionChange"
                :cell-class-name="cellStyleMethod"
                tooltip-effect="light"
            >
                <el-table-column type="expand">
                    <template slot-scope="props">
                        <div class="edu-auto-row">
                            <div class="edu-auto-col col" style="width:100%">
                                <div class="edu-auto-label">方案名称：</div>
                                <div class="edu-auto-content">{{ props.row.name }}</div>
                            </div>
                            <div class="edu-auto-col col">
                                <div class="edu-auto-label">年级：</div>
                                <div class="edu-auto-content">{{ props.row.grade }}</div>
                            </div>
                            <div class="edu-auto-col col">
                                <div class="edu-auto-label">培养层次：</div>
                                <div class="edu-auto-content">{{ props.row.trainingLevelI18n }}</div>
                            </div>
                            <div v-if="queryForm.projId == '1'" class="edu-auto-col col">
                                <div class="edu-auto-label">类别：</div>
                                <div
                                    class="edu-auto-content"
                                >{{ props.row.professionCateGory == "1"? "专业大类": "专业" }}</div>
                            </div>
                            <div class="edu-auto-col col">
                                <div class="edu-auto-label">学院：</div>
                                <div class="edu-auto-content">{{ props.row.facultyI18n }}</div>
                            </div>
                            <div class="edu-auto-col col">
                                <div class="edu-auto-label">专业：</div>
                                <div class="edu-auto-content">
                                    <span v-if="queryForm.projId != '1'">{{ props.row.majorI18n }}</span>
                                    <span v-else>{{ props.row.campusProfessionName }}</span>
                                </div>
                            </div>
                            <template v-if="queryForm.projId != '1'">
                                <div class="edu-auto-col col">
                                    <div class="edu-auto-label">培养类别：</div>
                                    <div
                                        class="edu-auto-content"
                                    >{{ props.row.trainingCategoryI18n }}</div>
                                </div>
                                <div class="edu-auto-col col">
                                    <div class="edu-auto-label">学习形式：</div>
                                    <div class="edu-auto-content">{{ props.row.formLearningI18n }}</div>
                                </div>
                                <div class="edu-auto-col col">
                                    <div class="edu-auto-label">学位类型：</div>
                                    <div class="edu-auto-content">{{ props.row.degreeTypeI18n}}</div>
                             </div>
                            </template>
                            <div class="edu-auto-col col">
                                <div class="edu-auto-label">审核状态：</div>
                                <div class="edu-auto-content">
                                  <el-tag v-if="props.row.status == 3" type="success" size="mini">通过</el-tag>
                                  <el-tag v-if="props.row.status == 1" type="info" size="mini">草稿</el-tag>
                                  <el-tag v-if="props.row.status == 2" type="warning" size="mini">审核中</el-tag>
                                  <el-tag v-if="props.row.status == 4" type="danger" size="mini">禁用</el-tag>
                                  <el-tag v-if="props.row.status == 5" type="danger" size="mini">变更中</el-tag>
                                </div>
                            </div>
                        </div>
                            
                    </template>
                </el-table-column>
                <el-table-column type="selection" width="55"/>
                <!-- 信息列表 -->
                <el-table-column label="方案名称" prop="name" min-width="150" show-overflow-tooltip>
                    <template slot-scope="scope">
                        <a
                                type="text"
                                @click="preview(scope.row)"
                            >{{ scope.row.name }}</a>
                    </template>
                </el-table-column>
                <el-table-column label="年级" prop="grade" width="80"/>
                <el-table-column label="培养层次" prop="trainingLevelI18n" width="80"/>
                <el-table-column v-if="queryForm.projId != '1'" label="学位类型" prop="degreeTypeI18n" width="80"/>
                <el-table-column label="学院" prop="facultyI18n" show-overflow-tooltip/>
                <div v-if="queryForm.projId == '1'">
                    <el-table-column label="类别" width="100">
                        <template
                            slot-scope="scope"
                        >{{ scope.row.professionCateGory=="1"? "专业大类": "专业" }}</template>
                    </el-table-column>
                </div>
                <template v-if="queryForm.projId == '1'">
                    <el-table-column label="校内专业" prop="campusProfessionName" min-width="100"/>
                </template>
                <template v-if="queryForm.projId != '1'">
                    <el-table-column label="专业" prop="majorI18n" min-width="100" show-overflow-tooltip/>
                    <el-table-column label="学习形式" prop="formLearningI18n" width="100"/>
                    <el-table-column label="培养类别" prop="trainingCategoryI18n" width="100" show-overflow-tooltip/>
                </template>

                <el-table-column label="审核状态" prop="status" width="80">
                    <template slot-scope="scope">
                        <el-tag v-if="scope.row.status == 3" type="success" size="mini">通过</el-tag>
                        <el-tag v-if="scope.row.status == 1" type="info" size="mini">草稿</el-tag>
                        <el-tag v-if="scope.row.status == 2" type="warning" size="mini">审核中</el-tag>
                        <el-tag v-if="scope.row.status == 4" type="danger" size="mini">禁用</el-tag>
                        <el-tag v-if="scope.row.status == 5" type="danger" size="mini">变更中</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="操作" width="120">
                    <template slot-scope="scope">
                        <el-button
                            v-if="(scope.row.status == 1  || scope.row.status == 5) && scope.row.schemaIsopen != 0"
                            type="text"
                            @click="handleEditItem(scope.row)"
                        >编辑</el-button>
                        <template v-if="showOperateButton && role == 4">
                            <el-button
                                v-if="scope.row.status == 1 || scope.row.status == 4 ||scope.row.status == 5 "
                                type="text"
                                @click="handleDelScheme(scope.row)"
                            >删除</el-button>
                        </template>
                        <template>
                            <el-button
                                v-if="scope.row.status == 3 && scope.row.schemaIsopen != 0"
                                type="text"
                                @click="sendChangeRequest(scope.row)"
                            >变更</el-button>
                            <el-button
                                v-if="scope.row.status == 2 &&  scope.row.schemaIsopen != 0"
                                type="text"
                                @click="handleViewItem(scope.row)"
                            >查看</el-button>
                            <el-button
                                v-if="scope.row.status == 2 && scope.row.workFolwId != 0 && scope.row.schemaIsopen != 0"
                                type="text"
                                @click="handleResetItem(scope.row)"
                            >撤销</el-button>
                        </template>
                    </template>
                </el-table-column>
            </el-table>
            <div class="edu-pagination">
                <div class="float-right">
                    <el-pagination
                        :current-page="queryForm.pageNum_"
                        :page-sizes="[20,50,100,500,1000]"
                        :page-size="queryForm.pageSize_"
                        :total="queryForm.total"
                        layout="total, sizes, prev, pager, next, jumper"
                        style="float: right;margin:0;"
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                    />
                </div>
            </div>
        </el-card>
        <!-- 批量创建培养方案 -->
        <el-dialog
            :visible.sync="batchCreateSchemesVisible"
            title="批量创建培养方案"
            class="form-content"
            width="50%"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
        >
            <el-form
                ref="batchCultrueScheme"
                :model="batchCultrueScheme"
                :rules="batchCultrueSchemeRules"
                label-position="left"
                label-width="90px"
                class="clearfix"
            >
                <el-row :gutter="20" style="height: 50px;">
                    <el-col :span="12">
                        <el-form-item label="年级:" prop="grade">
                            <el-date-picker
                                v-model="batchCultrueScheme.grade"
                                type="year"
                                value-format="yyyy"
                                placeholder="选择年级"
                                style="width: 100%;"
                                @change="batchFocusTplOpt"
                            />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="培养层次:" prop="trainingLevel">
                            <el-select
                                v-model="batchCultrueScheme.trainingLevel"
                                style="width: 100%;"
                                @change="batchFocusTplOpt"
                            >
                                <el-option
                                    v-for="item in options.trainingLevel"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="培养类别:" prop="trainingCategory">
                            <el-select v-model="batchCultrueScheme.trainingCategory" style="width: 100%"
                            @change="batchFocusTplOpt"
                            multiple collapse-tags>
                                <el-option
                                    v-for="item in options.trainingCategory"
                                    :key="item.code"
                                    :label="item.name"
                                    :value="item.code"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="学习形式:" prop="formLearning">
                            <el-select
                                v-model="batchCultrueScheme.formLearning"
                                style="width: 100%;"
                                placeholder="全部"
                                clearable
                                @change="batchFocusTplOpt"
                            >
                                <el-option
                                    v-for="item in options.formLearning"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">

                    
                        <el-form-item :label="$t('culture.scheme.degreeType') + ':'" prop="degreeType">
                            <el-select v-model="batchCultrueScheme.degreeType" style="width: 100%;"
                            placeholder="全部" clearable
                            @change="batchFocusTplOpt();changeFaculty(batchCultrueScheme.faculty)">
                                <el-option
                                    v-for="item in options.degreeType"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                ></el-option>
                            </el-select>
                        </el-form-item>
                       
                    </el-col>
                     <el-col :span="12">
                        <el-form-item label="模板名称:" prop="templateId">
                            <el-select
                                ref="template"
                                v-model="batchCultrueScheme.templateId"
                                :loading="loadingTeml"
                                :disabled="!isShowTemplateSelect"
                                filterable
                                reserve-keyword
                                style="width: 100%;"
                            >
                                <el-option
                                    v-for="item in options.batchTemplateName"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="学院:" prop="faculty">
                            <el-select
                                ref="faculty"
                                v-model="batchCultrueScheme.faculty"
                                filterable
                                style="width: 100%;"
                                @change="changeFaculty"
                                multiple collapse-tags
                                remote
                            >
                                <el-option
                                    v-for="item in options.faculty"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="专业:" prop="major">
                            <el-select
                                ref="major"
                                v-model="batchCultrueScheme.major"
                                filterable
                                multiple collapse-tags
                                style="width: 100%;"
                            >
                                <el-option
                                    v-for="item in options.batchCultrueSchemeMajor"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
             <div slot="footer" class="dialog-footer">
                 <el-row>
                     <el-col>
                        <el-button @click="batchCultrueSchemeReset('batchCultrueScheme')">取 消</el-button>
                        <el-button
                            :loading="addLoading"
                            type="primary"
                            @click="batchCultrueSchemeSubmit('batchCultrueScheme')"
                        >确 定</el-button>
                     </el-col>
                 </el-row>
            </div>
        </el-dialog>
        <!-- 本研新增 -->
        <el-dialog
            :visible.sync="showAddCultureSchemeDialog"
            title="创建培养方案"
            class="form-content"
            width="45%"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
        >
            <el-form
                ref="addCultureSchemeForm"
                :model="addCultureSchemeForm"
                :rules="addCultrueSchemeRules"
                label-position="right"
                label-width="96px"
            >
                <el-row :gutter="24" style="height: 27px;">
                    <el-col :span="24">
                        <el-checkbox
                            v-model="autoNameIsChecked"
                            style="float: right;"
                            label="自动命名"
                            name="type"
                        />
                    </el-col>
                </el-row>
                <el-row style="height: 50px;">
                    <el-col :span="24">
                        <el-form-item label="方案名称:" prop="name">
                            <el-input
                                v-model="addCultureSchemeForm.name"
                                placeholder="请输入内容"
                            />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row style="height: 50px;">
                    <el-col :span="24">
                        <el-form-item label="英文名称:" prop="nameEn">
                            <el-input v-model="addCultureSchemeForm.nameEn" placeholder="请输入内容"/>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="20" style="height: 50px;">
                    <el-col :span="12">
                        <el-form-item label="年级:" prop="grade">
                            <el-date-picker
                                v-model="addCultureSchemeForm.grade"
                                type="year"
                                value-format="yyyy"
                                placeholder="请选择"
                                style="width: 100%;"
                            />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="培养层次:" prop="trainingLevel">
                            <el-select
                                v-model="addCultureSchemeForm.trainingLevel"
                                style="width: 100%;"
                            >
                                <el-option
                                    v-for="item in options.trainingLevel"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row v-if="queryForm.projId == 1" :gutter="20" style="height: 50px;">
                    <el-col :span="12">
                        <el-form-item label="类别:" prop="professionCateGory">
                            <el-select
                                v-model="addCultureSchemeForm.professionCateGory"
                                style="width: 100%;"
                            >
                                <el-option
                                    v-for="item in options.professionCateGory"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row v-else :gutter="20" style="height: 50px;">
                    <el-col :span="12">
                        <el-form-item label="培养类别:" prop="trainingCategory">
                            <el-select v-model="addCultureSchemeForm.trainingCategory" style="width: 100%"
                            clearable multiple collapse-tags>
                                <el-option
                                    v-for="item in options.trainingCategory"
                                    :key="item.code"
                                    :label="item.name"
                                    :value="item.code"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="学习形式:" prop="formLearning">
                            <el-select
                                v-model="addCultureSchemeForm.formLearning"
                                style="width: 100%;"
                                placeholder="全部"
                                clearable
                            >
                                <el-option
                                    v-for="item in options.formLearning"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row v-if="queryForm.projId != 1">
                    <el-col>
                        <el-form-item :label="$t('culture.scheme.degreeType') +':'" prop="degreeType">
                            <el-select v-model="addCultureSchemeForm.degreeType" style="width: 100%;"
                            placeholder="全部" clearable>
                                <el-option
                                    v-for="item in options.degreeType"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col>
                        <el-form-item label="模板:" prop="templateId">
                            <el-select
                                ref="template"
                                v-model="addCultureSchemeForm.templateId"
                                filterable
                                style="width: 100%;"
                            >
                                <el-option
                                    v-for="item in options.templates"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="20" style="height: 50px;">
                    <el-col :span="12">
                        <el-form-item label="学院:" prop="faculty">
                            <el-select
                                ref="faculty"
                                v-model="addCultureSchemeForm.faculty"
                                filterable
                                style="width: 100%;"
                            >
                                <el-option
                                    v-for="item in options.faculty"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col v-if="queryForm.projId == 1" :span="12">
                        <el-form-item label="校内专业:" prop="campusProfession">
                            <el-select
                                ref="campusProfession"
                                v-model="addCultureSchemeForm.campusProfession"
                                filterable
                                style="width: 100%;"
                            >
                                <el-option
                                    v-for="item in options.campusProfessions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col v-else :span="12">
                        <el-form-item label="专业:" prop="major">
                            <el-select
                                ref="major"
                                v-model="addCultureSchemeForm.major"
                                @change="majorChange"
                                filterable
                                style="width: 100%;"
                            >
                                <el-option
                                    v-for="item in options.major"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row
                    v-if="addCultureSchemeForm.projId == 1 && addCultureSchemeForm.professionCateGory && addCultureSchemeForm.professionCateGory == 2"
                    :gutter="20"
                    style="height: 50px;"
                >
                    <el-col :span="12">
                        <el-form-item label="大类培养方案:" prop="trainingCategoryId">
                            <el-select
                                ref="faculty"
                                v-model="addCultureSchemeForm.trainingCategoryId"
                                filterable
                                style="width: 100%;"
                                @change="changeFaculty(addCultureSchemeForm.faculty)"
                            >
                                <el-option
                                    v-for="item in options.trainingCategoryId"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="showAddCultureSchemeDialog = false">{{ $t("message.cancel") }}</el-button>
                <el-button type="primary" @click="addCultrueScheme()">{{ $t("message.confirm") }}</el-button>
            </span>
        </el-dialog>
        <el-dialog
            :visible.sync="copyVisible"
            title="复制到..."
            width="35%"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
        >
            <el-form ref="year" :model="copyForm">
                <el-form-item
                    :rules="[
            { required: true, message: '请选择年级'}
          ]"
                    label="年级:"
                    prop="grade"
                >
                    <el-select v-model="copyForm.grade" placeholder="请选择年级" clearable>
                        <el-option
                            v-for="item in copyOptions.grade"
                            :key="item.value"
                            :label="item.label + '级'"
                            :value="item.value"
                        />
                    </el-select>
                </el-form-item>
                <el-form-item v-if="!!copyForm.grade">
                    <i class="el-icon-warning"></i>
                    <span>选择年级将会生成该年级新的方案</span>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="resetCopy('year')">取 消</el-button>
                <el-button type="primary" @click="copyOk('year')">保存</el-button>
            </div>
        </el-dialog>
        <el-dialog
            :visible.sync="showSendChangeRequestDialog"
            title="变更"
            width="40%"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
        >
            <span>是否同步到个人计划:</span>
            <el-radio v-model="isSynchronousPlan" label="0">不同步</el-radio>
            <el-radio v-model="isSynchronousPlan" label="1">同步</el-radio>
            <span slot="footer" class="dialog-footer">
                <el-button @click="showSendChangeRequestDialog = false">{{ $t("message.cancel") }}</el-button>
                <el-button type="primary" @click="sendChangeRequest()">{{ $t("message.confirm") }}</el-button>
            </span>
        </el-dialog>

        <el-dialog
            :visible.sync="showBatchCreateResultDialog"
            title="批量创建结果"
            width="40%"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
        >
            <div>{{result.msg}}</div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="showBatchCreateResultDialog = false">{{ $t("message.confirm") }}</el-button>
            </span>
        </el-dialog>
    </div>
</template>
<script>
import bus from "common/src/utils/bus";
import * as API from "common/src/api/culture/cultruescheme";
import UTILS from "common/src/utils/utils";
import {
    queryDic,
    findTrainingLevelByProjId,
    findDictByCondition,
    sortTrainingCategories
} from "common/src/api/dictionary";
import { findFaculty } from "common/src/api/faculty";
import { getGraduateDegreePage } from "common/src/api/resource/course";
import { getPower } from 'common/src/api/culture/culturePlan'
export default {
    name: "culture-scheme-manage",
    data() {
        const lengthRule = {
            min: 1,
            max: 256,
            message: "长度在 1 到 256 个字符",
            trigger: "blur"
        };
        //todo
        return {
            showBatchCreateResultDialog: false,
            showSendChangeRequestDialog: false,
            showAddCultureSchemeDialog: false,
            addCultureSchemeForm: {
                name: "",
                nameEn: "",
                templateId: "",
                grade: "",
                trainingLevel: "",
                professionCateGory: "",
                faculty: "",
                major: "",
                campusProfession: "",
                formLearning: "",
                trainingCategory: [],
                condition: "",
                projId: '',
                degreeType: ""
            },
            addCultrueSchemeRules: {
                name: [
                    {
                        required: true,
                        message: "请输入方案名称",
                        trigger: "change"
                    },
                    lengthRule
                ],
                nameEn: [
                    {
                        required: true,
                        message: "请输入方案英文名称",
                        trigger: "change"
                    },
                    lengthRule
                ],
                templateId: [
                    {
                        required: true,
                        message: "请选择培养模板",
                        trigger: "change"
                    }
                ],
                faculty: [
                    { required: true, message: "请选择学院", trigger: "change" }
                ],
                major: [
                    { required: true, message: "请选择专业", trigger: "change" }
                ],
                campusProfession: [
                    {
                        required: true,
                        message: "请选择校内专业",
                        trigger: "change"
                    }
                ],
                professionCateGory: [
                    { required: true, message: "请选择类别", trigger: "change" }
                ],
                formLearning: [
                    {
                        required: false,
                        message: "请选择学习形式",
                        trigger: "blur"
                    }
                ],
                trainingCategory: [
                    {
                        required: true,
                        message: "请选择培养类别",
                        trigger: "change"
                    }
                ],
                grade: [
                    {
                        required: true,
                        message: "请选择年级",
                        trigger: "change"
                    }
                ],
                trainingLevel: [
                    {
                        required: true,
                        message: "请选择培养层次",
                        trigger: "change"
                    }
                ],
                degreeType: [
                    {
                        required: false,
                        message: "请选择学位类型",
                        trigger: "change"
                    }
                ],
            },
            curList: [],
            curChangeList: [],
            loading: false,
            copyVisible:false,
            loadingTeml: false,
            cultrueScheme: {
                templateId: "",
                name: "",
                nameEn: "",
                grade: "",
                trainingLevel: "", // 培养层次
                trainingCategory: "", // 培养类别
                faculty: "", // 学院
                major: "", // 专业
                degreeCategory: "", // 学位类别
                degreeType: "", // 学位类型
                formLearning: "", // 学习形式
                spcialPlan: "", // 专项计划
                studentAbroad: "", // 国际学生
                direction: "", // 方向
                lengthSchooling: "0", // 学制
                maxLengthSchooling: "0", // 最长在校时间
                remark: "" // 备注
            },
            batchCultrueScheme: {
                templateId: "",
                grade: "",
                trainingLevel: "", // 培养层次
                faculty: [], // 学院
                major: [], // 专业
                formLearning: "", // 学习形式
                degreeType: "", // 学位类型
                direction: "",// 方向
                trainingCategory: []
            },
            copyForm:{
                grade:'',
                cultureSchemeIds:[],
            },
            cultrueSchemeRules: {
                name: [
                    {
                        required: true,
                        message: "请输入方案名称",
                        trigger: "blur"
                    },
                    {
                        min: 1,
                        max: 256,
                        message: "长度在 1 到 256 个字符",
                        trigger: "blur"
                    }
                ],
                nameEn: [
                    {
                        min: 1,
                        max: 256,
                        message: "长度在 1 到 256 个字符",
                        trigger: "blur"
                    }
                ],
                templateId: [
                    {
                        required: true,
                        message: "请选择培养模板",
                        trigger: "blur"
                    }
                ],
                faculty: [
                    { required: true, message: "请选择学院", trigger: "blur" }
                ],
                major: [
                    { required: true, message: "请选择专业", trigger: "blur" }
                ],
                remark: [
                    {
                        min: 1,
                        max: 256,
                        message: "长度在 1 到 256 个字符",
                        trigger: "blur"
                    }
                ]
            },
            batchCultrueSchemeRules: {
                grade: [
                    { required: true, message: "请选择学级", trigger: "blur" }
                ],
                trainingLevel: [
                    {
                        required: true,
                        message: "请选择培养层次",
                        trigger: "change"
                    }
                ],
                trainingCategory: [
                    {
                        required: true,
                        message: "请选择培养类别",
                        trigger: "change"
                    }
                ],
                formLearning: [
                    {
                        required: false,
                        message: "请选择学习形式",
                        trigger: "change"
                    }
                ],
                templateId: [
                    {
                        required: true,
                        message: "请选择培养模板",
                        trigger: "change"
                    }
                ]
            },
            // 筛选相关选项
            queryForm: {
                "x-token": "",
                grade: "", // 年级
                trainingLevel: "", // 培养层次
                faculty: "", // 学院
                major: "", // 专业
                degreeType: "", // 学位类型
                formLearning: "", // 学习形式
                spcialPlan: "", // 专项计划
                studentAbroad: "", // 国际学生
                status: "", // 状态
                name: "", // 名称
                pageNum_: 1,
                pageSize_: 20,
                total: 0,
                projId: "1",
                professionCateGory: "",
                trainingCategory: []
            },
            copyOptions: {
                grade: [],
            },
            // 下拉相关选项数据
            options: {
                grade: [],
                trainingLevel: [],
                faculty: [],
                major: [],
                batchCultrueSchemeMajor: [],
               // degreeType: [],
                spcialPlan: [],
                formLearning: [],
                studentAbroad: [],
                status: [
                    {
                        label: "通过",
                        value: 3
                    },
                    {
                        label: "草稿",
                        value: 1
                    },
                    {
                        label: "审核中",
                        value: 2
                    },
                    {
                        label: "禁用",
                        value: 4
                    },
                    {
                        label: "变更中",
                        value: 5
                    }
                ],
                templateName: [],
                degreeType: [], // 学位类型
                degreeCategory: [], // 学位类别
                trainingCategory: [], // 培养类别,
                professionCateGory: [
                    { value: "1", label: "专业大类" },
                    { value: "2", label: "专业" }
                ],
                project: [],
                templates: [],
                campusProfessions: [],
                trainingCategoryId: [] //大类培养方案
            },
            tableData: [],
            autoNameIsChecked: false,
            showAlert: false, // 显示错误提示
            alertTitle: "",
            // 新增相关数据
            addFormVisible: false,
            examineVisible: false,
            schemeInfo: "",
            examineFileList: [],
            examineInfo: {
                type: 11,
                id: "",
                editExplain: "",
                evidenceList: []
            },
            addLoading: false,
            addFormRules: {},
            multipleSelection: [],
            batchCreateSchemesVisible: false,
            curItem: null,
            isSynchronousPlan: "0",
            result: {},
            showOperateButton: false,
            role:'',
            startTime:'',
            endTime:''
        };
    },
    computed: {
        isShowTemplateSelect() {
            return (
                this.batchCultrueScheme.grade &&
                this.batchCultrueScheme.trainingLevel &&
                this.batchCultrueScheme.trainingCategory && this.batchCultrueScheme.trainingCategory.length > 0
            );
        },
        faculty() {
            return this.addCultureSchemeForm.faculty;
        },
        major() {
            return this.addCultureSchemeForm.major;
        },
        campusProfession() {
            return this.addCultureSchemeForm.campusProfession;
        },
        template() {
            return this.addCultureSchemeForm.templateId;
        }
    },
    watch: {
        showAddCultureSchemeDialog: function(_n, _o) {
            if (!_n) {
                this.resetAddForm();
                this.options.templates = [];
                this.options.major = [];
                this.options.campusProfessions = [];
            }
        },
        "addCultureSchemeForm.grade": function(_new, _old) {
            //清空大类培养方案列表
            if(_new){
                this.options.trainingCategoryId = [];

                let props = [
                    "templateId", //* 模板
                    "campusProfession", //* 校内专业
                    "trainingCategoryId" //* 大类培养方案
                ];
                this.clearAddCultureSchemeForm(props);

                //* 获取模板
                this.addCultrueTemplates();

                //* 获取校内专业
                this.addCampusProfessions();

                //* 获取大类培养方案
                this.addTrainingCategoryId();
            }
        },
        "addCultureSchemeForm.trainingLevel": function(_new, _old) {
            if(_new){
                //清空大类培养方案列表
                this.options.trainingCategoryId = [];
                //* 培养层次
                let props = [
                    "templateId", //* 模板
                    "campusProfession", //* 校内专业
                    "trainingCategoryId" //* 大类培养方案
                ];
                this.clearAddCultureSchemeForm(props);

                //* 获取模板
                this.addCultrueTemplates();

                //* 获取校内专业
                this.addCampusProfessions();

                //* 获取大类培养方案
                this.addTrainingCategoryId();
            }
        },
        "addCultureSchemeForm.professionCateGory": function(_new, _old) {
            if(_new){
                //清空大类培养方案列表
                this.options.trainingCategoryId = [];
                //* 类别
                let props = [
                    "templateId", //* 模板
                    "campusProfession", //* 校内专业
                    "trainingCategoryId" //* 大类培养方案
                ];
                this.clearAddCultureSchemeForm(props);

                //* 获取模板
                this.addCultrueTemplates();

                //* 获取校内专业
                this.addCampusProfessions();

                //* 获取大类培养方案
                this.addTrainingCategoryId();
            }
        },
        "addCultureSchemeForm.formLearning": function(_new, _old) {
            if(_new){
                 //* 学习形式
                let props = [
                    "templateId" //* 模板
                ];
                this.clearAddCultureSchemeForm(props);

                //* 获取模板
                this.addCultrueTemplates();
            }
        },
        "addCultureSchemeForm.trainingCategory": function(_new, _old) {
            if(_new && _new.length > 0){              //* 培养类别
                let props = [
                    "templateId" //* 模板
                ];
                this.clearAddCultureSchemeForm(props);

                //* 获取模板
                this.addCultrueTemplates();
            }
        },
        "addCultureSchemeForm.degreeType": function(_new, _old) {
            if(_new){
                 //* 学位类型
                if ("1" === this.addCultureSchemeForm.projId) {
                    this.addCampusProfessions();
                } else {
                    this.addMajors();
                }
                
                let props = [
                    "templateId" //* 模板
                ];
                this.clearAddCultureSchemeForm(props);
                
                //* 获取模板
                this.addCultrueTemplates();
            }
        },
        "addCultureSchemeForm.faculty": function(_new, _old) {
            if(_new){
                //清空大类培养方案列表
                this.options.trainingCategoryId = [];
                //* 学院
                let props = [
                    "campusProfession", //* 校内专业,
                    "major", //* 专业,
                    "trainingCategoryId" //* 大类培养方案
                ];
                if (this.autoNameIsChecked) {
                    this.addCultureSchemeForm.name = "";
                }
                this.clearAddCultureSchemeForm(props);

                //* 获取模板
                this.addCultrueTemplates();

                //* 获取校内专业或专业
                if ("1" === this.addCultureSchemeForm.projId) {
                    this.addCampusProfessions();
                } else {
                    this.addMajors();
                }
                //* 获取大类培养方案
                this.addTrainingCategoryId();
                this.autoName();
                }
        },
        "addCultureSchemeForm.campusProfession": function(_new, _old) {
            //清空大类培养方案列表
            this.options.trainingCategoryId = [];
            //* 校内专业
            let props = [
                "trainingCategoryId" //* 大类培养方案
            ];
            if (this.autoNameIsChecked) {
                this.addCultureSchemeForm.name = "";
            }
            this.clearAddCultureSchemeForm(props);

            //* 获取大类培养方案
            this.addTrainingCategoryId();
            this.autoName();
        },
        "addCultureSchemeForm.templateId": function(_new, _old) {
            //* 模板
            if (this.autoNameIsChecked) {
                this.addCultureSchemeForm.name = "";
            }
            this.autoName();
        },
        "addCultureSchemeForm.major": function(_new, _old) {
            //* 专业
            if (this.autoNameIsChecked) {
                this.addCultureSchemeForm.name = "";
            }
            this.autoName();
        },
        "options.trainingCategoryId": function(newValue) {
            if (newValue.length > 0)
                this.addCultrueSchemeRules.trainingCategoryId = [
                    {
                        required: true,
                        message: "请选择大类培养方案",
                        trigger: "change"
                    }
                ];
            if (newValue.length === 0)
                delete this.addCultrueSchemeRules.trainingCategoryId;
        }
    },
    created() {
        this.init();
        this.getRole();
        this.getSetTime();
        bus.$on("updateCurrentManageDeptId", currentManageDeptId => {
            this.queryForm.projId = currentManageDeptId;
            this.handleChange();
            //清空筛选条件
            this.clearSearch();
        });
        this.initProjId();
        this.initTrainingLevelOptions();
        this.handleSearch();
    },
    methods: {
        cellStyleMethod({row, column, rowIndex, columnIndex}){
            if (columnIndex == 2) {
                return 'normal-cell';
            }
        },
        //重新赋值

        initProjId() {
            let currentUser =
                (this.$store.state.session && this.$store.state.session.user) ||
                JSON.parse(localStorage.getItem("user"));
            this.queryForm.projId = currentUser.currentManageDptId;
            // 校级管理员判断
            this.showOperateButton = (currentUser.currentRole == 1 && (currentUser.innerRoles.indexOf("1") != -1));
            // 绑定年级
            const now = new Date();
            const currentYear = now.getFullYear()+1;
            const minYear = currentYear - 6;
            for (let year = currentYear; year > minYear; year--) {
                const obj = { label: year, value: year };
                this.copyOptions.grade.push(obj);
            }
        },
        initTrainingLevelOptions() {
            findTrainingLevelByProjId(this.queryForm.projId).then(res => {
                if (res.code === 200) {
                    this.queryForm.trainingLevel = "";
                    this.loadTrainingLevelOptions("trainingLevel", res.data);
                }
            });
        },
        preview(row) {
            let schemeDetails =  {
                    projId: this.queryForm.projId,
                    id: row.id,
                    dataType: 2,
                    nameCN:row.name,
                    nameEN:row.nameEn
                }
            sessionStorage.setItem("schemeDetails",JSON.stringify(schemeDetails));
            this.$router.push({
                name: "cultureSchemePreview",
                params: {
                    projId: this.queryForm.projId,
                    id: row.id,
                    dataType: 2
                }
            });
        },
        getRole(){
            getPower().then((res) => {
                this.role = res.data.power;
            })
        },
        getSetTime(){
            let data = {
                grade: "", // 年级
                deptCode: "", // 学院
                startTime: "", // 开始时间
                stopTime: "", // 结束时间
                projId:this.queryForm.projId
            }
            API.schemefindResult(data).then(res =>{
                if(res.code == 200){
                    let date = new Date(res.data.startTime);
                    let Y = date.getFullYear() + '-';
                    let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
                    let D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
                    let h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
                    let m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':';
                    let s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds()); 
                    this.startTime = Y+M+D+h+m+s
                    let date2 = new Date(res.data.stopTime);
                    let Y1 = date2.getFullYear() + '-';
                    let M1 = (date2.getMonth()+1 < 10 ? '0'+(date2.getMonth()+1) : date2.getMonth()+1) + '-';
                    let D1 = (date2.getDate() < 10 ? '0'+date2.getDate() : date2.getDate()) + ' ';
                    let h1 = (date2.getHours() < 10 ? '0'+date2.getHours() : date2.getHours()) + ':';
                    let m1 = (date2.getMinutes() < 10 ? '0'+date2.getMinutes() : date2.getMinutes()) + ':';
                    let s1 = (date2.getSeconds() < 10 ? '0'+date2.getSeconds() : date2.getSeconds()); 
                    this.endTime = Y1+M1+D1+h1+m1+s1
                       
                }
            })
        },
        //清空筛选条件
        clearSearch() {
            if(this.role == 3){
                this.queryForm.grade = "";
                this.queryForm.trainingLevel = "";
                this.queryForm.campusProfession = "";
                this.queryForm.major = "";
                this.queryForm.degreeType = "";
                this.queryForm.formLearning = "";
                this.queryForm.spcialPlan = "";
                this.queryForm.studentAbroad = "";
                this.queryForm.status = "";
                this.queryForm.name = "";
                this.queryForm.professionCateGory = "";
                this.queryForm.trainingCategory = [];
            }else{
                this.queryForm.grade = "";
                this.queryForm.trainingLevel = "";
                this.queryForm.faculty = "";
                this.queryForm.campusProfession = "";
                this.queryForm.major = "";
                this.queryForm.degreeType = "";
                this.queryForm.formLearning = "";
                this.queryForm.spcialPlan = "";
                this.queryForm.studentAbroad = "";
                this.queryForm.status = "";
                this.queryForm.name = "";
                this.queryForm.professionCateGory = "";
                this.queryForm.trainingCategory = [];
                // 清空下拉
                this.options.campusProfessions = [];
                this.options.major = [];
            }
        },
        addCultrueTemplates() {
            //* 获取模板
            let templatesParams = {};
            templatesParams.grade = this.addCultureSchemeForm.grade;
            templatesParams.projId = this.addCultureSchemeForm.projId;
            templatesParams.trainingLevel = this.addCultureSchemeForm.trainingLevel;
            if (templatesParams.projId == "1") {
                templatesParams.professionCateGory = this.addCultureSchemeForm.professionCateGory;
            } else {
                templatesParams.formLearning = this.addCultureSchemeForm.formLearning;
                templatesParams.trainingCategory = this.addCultureSchemeForm.trainingCategory;
                templatesParams.degreeType = this.addCultureSchemeForm.degreeType;
            }
            this.queryCultureTemplates(templatesParams);
        },
        addCampusProfessions() {
            // 必须是本科生
            if ("1" !== this.addCultureSchemeForm.projId) {
                return;
            }
            
            this.options.campusProfessions = [];
            if(!(this.addCultureSchemeForm.grade && this.addCultureSchemeForm.faculty)) {
              // 年级选择提示
              this.$refs.addCultureSchemeForm.validateField('grade');
              return
            }
            let campusProfessionParams = {};
            campusProfessionParams.grade = this.addCultureSchemeForm.grade;
            campusProfessionParams.trainingLevel = this.addCultureSchemeForm.trainingLevel;

            campusProfessionParams.category = this.addCultureSchemeForm.professionCateGory;
            campusProfessionParams.faculty = this.addCultureSchemeForm.faculty;
            this.queryCampusProfessions(campusProfessionParams);
        },
        addMajors() {
            //* 获取专业
            if (
                "1" === this.addCultureSchemeForm.projId ||
                !this.addCultureSchemeForm.faculty
            ) {
                return;
            }
            this.queryMajors(this.addCultureSchemeForm.faculty, this.addCultureSchemeForm.degreeType);
        },
        addTrainingCategoryId() {
            //* 获取大类培养方案

            let params = {};
            params.grade = this.addCultureSchemeForm.grade;
            params.trainingLevel = this.addCultureSchemeForm.trainingLevel;
            params.professionCateGory = this.addCultureSchemeForm.professionCateGory;
            params.faculty = this.addCultureSchemeForm.faculty;
            params.campusProfession = this.addCultureSchemeForm.campusProfession;

            let campusProfessionItem = this.options.campusProfessions.find(
                item => {
                    return (
                        item.value == this.addCultureSchemeForm.campusProfession
                    );
                }
            );
            if (campusProfessionItem) {
                params.campusProfessionName = campusProfessionItem.label;
            }
            if (
                params.grade &&
                params.faculty &&
                params.trainingLevel &&
                params.campusProfession &&
                params.campusProfessionName &&
                params.professionCateGory &&
                params.professionCateGory == 2
            ) {
                this.queryTrainingCategoryScheme(params);
            }
        },
        queryTrainingCategoryScheme(params) {
            const query = params || this.getCreateData();
            if (query.campusProfession) {
                API.findTrainingCategoryScheme(query).then(res => {
                    if (res.code == 200 && res.data) {
                        this.options.trainingCategoryId = res.data.map(e => {
                            return {
                                label: e.name,
                                value: e.id
                            };
                        });
                    }
                });
            }
        },
        // queryOptions() {
        //     if (!this.isQuerytemplate()) return;
        //     const query = this.getQueryTemplateParams();
        //     this.queryCultureTemplates(query);
        //     if (
        //         this.queryForm.projId == "1" &&
        //         this.addCultureSchemeForm.faculty
        //     ) {
        //         query.faculty = this.addCultureSchemeForm.faculty;
        //         this.queryCampusProfessions(query);
        //     }
        // },
        queryCampusProfessions(query) { // 查询校内专业（本科生）
            this.options.campusProfessions = [];
            Vue.set(this.queryForm, "campusProfession", "");
            // 联动校验
            if(!(query.grade && query.faculty)) {
              return
            }
            if(query.professionCateGory){
                query.category = query.professionCateGory;
            }else{
                query.category = query.category;
            }
            API.findProfessionByParam(query).then(res => {
                if (res.code === 200) {
                    this.options.campusProfessions = res.data.map(
                        (item, index) => {
                            return {
                                label: item.professionCateGoryName,
                                value: item.professionCateGory
                            };
                        }
                    );
                }
            });
        },
        queryCultureTemplates(query) {
            API.cultureTemplateListNew(query).then(res => {
                if (res.code === 200) {
                    this.options.templates = res.data.map((item, index) => {
                        return {
                            label: item.name,
                            value: item.id
                        };
                    });
                }
            });
        },
        isQuerytemplate() {
            const form = this.addCultureSchemeForm;
            const flag = form.grade && form.trainingLevel;
            if (form.projId == "1") return flag && form.professionCateGory;
            else return flag && form.formLearning && form.trainingCategory;
        },
        getQueryTemplateParams() {
            const data = {};
            data.grade = this.addCultureSchemeForm.grade;
            data.projId = this.addCultureSchemeForm.projId;
            data.trainingLevel = this.addCultureSchemeForm.trainingLevel;
            if (data.projId == "1") {
                data.professionCateGory = this.addCultureSchemeForm.professionCateGory;
            } else {
                data.formLearning = this.addCultureSchemeForm.formLearning;
                data.trainingCategory = this.addCultureSchemeForm.trainingCategory;
            }
            return data;
        },
        copy() {
            if (this.multipleSelection.length === 0) {
                this.$message({
                    type: "info",
                    message: "请选择要复制的培养方案"
                });
                return;
            }
            this.copyVisible = true;
        },
        copyOk(formName) {
            this.$refs[formName].validate(valid => {
                if (valid) {
                    
                    this.copyForm.cultureSchemeIds = _.map(this.multipleSelection, "id"); 
                    console.log(this.copyForm)
                    API.copyCultureSchemeList(this.copyForm).then(res => {
                        if (res && res.code === 200) {
                            this.copyVisible = false;
                            this.handleSearch();
                            // let message = "由于培养方案批量复制每条数据结果差异，可前往公共导出页面查看批量复制培方案模板情况表格详情。";
                            // this.$alert(message, '批量复制结果')
                            //     .then(res => {
                            //         this.onSubmit();
                            //         this.multipleSelection.length = 0;
                            //         this.$refs[formName].resetFields();
                            //         this.$router.push({path: `/publicExport`});
                            //     });

                        }
                    });
                }
            });
        },
        resetCopy(formName) {
            this.copyVisible = false;
            this.$refs[formName].resetFields();
        },
        addCultrueScheme(flag) {
            //to-delete
            if (flag) {
                this.addCultureSchemeForm.projId = this.queryForm.projId;
                this.showAddCultureSchemeDialog = true;
            } else this.createCultureScheme();
        },
        createCultureScheme() {
            //to-delete
            this.$refs["addCultureSchemeForm"].validate(valid => {
                if (valid) {
                    API.addCultureScheme(this.getCreateData()).then(res => {
                        if (res.code === 200) {
                            this.showAddCultureSchemeDialog = false;
                            this.$message.success({
                                type: "success",
                                message: "培养方案创建成功！"
                            });
                            this.handleSearch();
                        }
                    });
                } else return false;
            });
        },
        getlabelFromOptions(option, value) {
            const item = this.options[option].find(item => {
                return item.value == value;
            });
            if (item) return item.label;
            else return "";
        },
        getCreateData() {
            this.addCultureSchemeForm.grade = this.addCultureSchemeForm.grade;
            const campusProfessionItem = this.options.campusProfessions.find(
                item => {
                    return (
                        item.value == this.addCultureSchemeForm.campusProfession
                    );
                }
            );
            if (campusProfessionItem) {
                this.addCultureSchemeForm.campusProfessionName =
                    campusProfessionItem.label;
                this.addCultureSchemeForm.campusProfession =
                    campusProfessionItem.value;
            }
            return this.addCultureSchemeForm;
        },
        queryCampusMajor() { // 综合查询专业（本研不分）
            if (this.queryForm.projId == "1") {
                this.queryCampusProfessions(this.queryForm);
            } else this.queryMajors(this.queryForm.faculty, this.queryForm.degreeType);
        },
        changeFaculty(faculty) {
            console.log("faculty")
            console.log(faculty)
            if(!faculty) {
                return
            }
            if (this.queryForm.projId == "1") {
                const query = this.getQueryTemplateParams();
                query.faculty = faculty;
                this.queryCampusProfessions(query);
            } else {
                if (faculty.length > 0) {
                    let promiseArr = faculty.map(item =>
                        this.getGraduateDegreePage(item, this.batchCultrueScheme.degreeType)
                    );
                    Promise.all(promiseArr).then(res => {
                        this.options.batchCultrueSchemeMajor = res.reduce(
                            (prev, curr, index) => {
                                let {
                                    code,
                                    data: { list }
                                } = curr;
                                if (code === 200) {
                                    let majorList = list.map(item => ({
                                        value: item.code,
                                        label:
                                            "cn" !==
                                            this.$store.getters.language
                                                ? item.nameEn + ' ' + item.code
                                                : item.name +' ' + item.code
                                    }));
                                    prev = [...prev, ...majorList];
                                }
                              // console.log(this.options.batchCultrueSchemeMajor)
                                return prev;
                            },
                            []
                        );
                        this.batchCultrueScheme.major = this.batchCultrueScheme.major.filter(
                            e =>
                                !!this.options.batchCultrueSchemeMajor.find(
                                    item => item.value === e
                                )
                        );
                    });
                    this.options.batchCultrueSchemeMajor = [];
                }else{
                    this.batchCultrueScheme.major = [];
                    this.options.batchCultrueSchemeMajor = [];
                 console.log(this.batchCultrueScheme.major)
                console.log(this.options.batchCultrueSchemeMajor)
                }
            }
        },
        queryMajors(college, degreeType) { // 查询专业（研究生）
            this.options["major"] = [];
            Vue.set(this.queryForm, "major", "");
            let promise = this.getGraduateDegreePage(college, degreeType);
            promise.then(response => {
                this.curList = response.data.list;
                let {
                    code,
                    data: { list }
                } = response;
                if (code === 200) {
                    this.options.major = list.map(item => ({
                        value: item.code,
                        label:
                            "cn" === this.$store.getters.language
                                ? item.name + ' ' + item.code
                                : item.nameEn + ' ' + item.code
                    }));
                }
            });
        },
        //根据专业code获取专业名称
        majorChange() {
            this.curChangeList = [];
            this.curList.filter((item) => {
                if (item.code === this.addCultureSchemeForm.major) {
                    this.curChangeList.push(item);
                }
            });
        },
        getGraduateDegreePage(college, degreeType) {
            const data = {
                college: college,
                page: false,
                isRecruit: 1,
                type: degreeType
            };
            return getGraduateDegreePage(data);
        },
        init() {
            this.queryForm["x-token"] =
                this.$store.state.session.sessionid ||
                localStorage.getItem("sessionid") ||
                "";
            getPower().then((res) => {
                this.role = res.data.power
                if(res.data.departmentCode.indexOf(",") !=-1){
                    let departmentCode = res.data.departmentCode.split(",")
                    this.queryForm.faculty = departmentCode[0]
                }else{
                    this.queryForm.faculty = res.data.departmentCode
                }
                if (this.queryForm.faculty) {
                    this.onSubmit();
                }
                if(res.data.departmentCode && res.data.power == 3){
                    this.queryCampusMajor()
                }
            })
            this.initOptions();
        },
        // 获取模板列表
        cultureTplOptions(str) {
            const that = this;
            if (str !== "") {
                this.loadingTeml = true;
                const query = {
                    condition: str
                };
                setTimeout(() => {
                    API.cultureTemplateList(query).then(res => {
                        this.loadingTeml = false;
                        if (res && res.data) {
                            that.options.templateName = [];
                            for (const index in res.data) {
                                const option = {
                                    label: res.data[index].name,
                                    value: res.data[index].id,
                                    item: res.data[index]
                                };
                                that.options.templateName.push(option);
                            }
                        }
                    });
                }, 200);
            } else {
                that.options.templateName = [];
            }
        },
        changTplOpt(val) {
            const currentTplOpt = _.find(this.options.templateName, {
                value: val
            });
            this.cultrueScheme.trainingLevel = currentTplOpt.item.trainingLevel;
            this.cultrueScheme.formLearning = currentTplOpt.item.formLearning;
            this.cultrueScheme.grade = currentTplOpt.item.year;
        },
        focusTplOpt() {
            const that = this;
            this.loadingTeml = true;
            that.options.templateName = [];
            setTimeout(() => {
                API.cultureTemplateList().then(res => {
                    this.loadingTeml = false;
                    if (res && res.data) {
                        that.options.templateName = [];
                        for (const index in res.data) {
                            const option = {
                                label: res.data[index].name,
                                value: res.data[index].id,
                                item: res.data[index]
                            };
                            that.options.templateName.push(option);
                        }
                    }
                });
            }, 200);
        },
        batchFocusTplOpt() {
            if(!this.isShowTemplateSelect) {
                return
            }
            this.loadingTeml = true;
            let trainingCategorys=this.batchCultrueScheme.trainingCategory.toString();
            const params = {
                projId: this.queryForm.projId, // 本研
                grade: this.batchCultrueScheme.grade, // 年级
                trainingLevel: this.batchCultrueScheme.trainingLevel, // 培养层次
                trainingCategory:trainingCategorys,// 培养类型
                formLearning: this.batchCultrueScheme.formLearning,// 学习形式
                degreeType: this.batchCultrueScheme.degreeType// 学位类型
            };
            setTimeout(() => {
                API.cultureTemplateListNew(params).then(res => {
                    this.batchCultrueScheme.templateId = "";
                    this.loadingTeml = false;
                    if (res.code === 200) {
                        this.options.batchTemplateName = [];
                        this.options.batchTemplateName = res.data.map((item, index) => {
                            return {
                                label: item.name,
                                value: item.id
                            };
                        });
                    }
                });
            }, 200);
        },
        initOptions() {
            findFaculty().then(res => { 
                let data = {"X_YX": res.data};
                UTILS.fillSelect({ faculty: "X_YX" }, data, this.options);
            });
            const data = {
                lang: this.$store.getters.language || "cn",
                type: "allChild",
                keys: [
                    "X_PYCC",
                    "K_XXXS",
                    "X_ZXJH",
                    "X_PYLB",
                    "X_XWLB",
                    "X_XWLX",
                    "X_GLBM"
                ]
            };
            queryDic(data)
                .then(res => {
                    if (res.code === 200) {
                        let params = {
                            lang: this.$store.getters.language,
                            keys: ["X_PYLB"]
                        };
                        sortTrainingCategories(params).then((res) => {
                            this.options.trainingCategory = res.data.X_PYLB;
                        });
                        // this.fillSelect(res.data);
                        UTILS.fillSelect(
                            {
                                degreeCategory: "X_XWLB",
                                spcialPlan: "X_ZXJH",
                                formLearning: "K_XXXS",
                                degreeType: "X_XWLX",
                                // trainingCategory: "X_PYLB",
                                project: "X_GLBM"
                            },
                            res.data,
                            this.options
                        );
                    }
                })
                .catch(error => {
                    console.log(error);
                });
        },
        remoteCultureTemplates(str) {
            alert(str)
            this.cultureTplOptions(str);
        },
        handleChange() {
            // 动态培养层次数据
            findTrainingLevelByProjId(this.queryForm.projId).then(res => {
                if (res.code === 200) {
                    this.queryForm.trainingLevel = "";
                    this.loadTrainingLevelOptions("trainingLevel", res.data);
                }
            });
            this.onSubmit();
        },
        handleSearch() {
            API.findCultureSchemeList(this.queryForm)
                .then(res => {
                    if (res && res.data) {
                        this.tableData = res.data.list;
                        this.queryForm.total = res.data.total_;
                    }
                })
                .catch(function(error) {
                    this.$message({
                        type: "error",
                        showClose: true,
                        message: "请求出现异常",
                        duration: 2000
                    });
                });
        },
        loadTrainingLevelOptions(optionKey, dataObj) {
            this.options[optionKey] = [];
            _.each(dataObj, level => {
                this.options[optionKey].push({
                    label:
                        "en" === this.$store.getters.language
                            ? level.nameEN
                            : level.nameCN,
                    value: level.code
                });
            });
        },
        reset(ref) {
            this.clearSearch();
            this.handleChange();
        },
        onSubmit() {
            this.queryForm.pageNum_ = 1;
            this.handleSearch();
        },
        handSearchChang() {
            this.onSubmit();
        },
        handleSizeChange(val) {
            this.queryForm.pageSize_ = val;
            this.handleSearch();
        },
        handleCurrentChange(val) {
            this.queryForm.pageNum_ = val;
            this.handleSearch();
        },
        handleDelScheme(obj) {
            this.$confirm(
                this.$t("message.deleteConfirm"),
                this.$t("message.prompt"),
                {
                    confirmButtonText: this.$t("message.confirm"),
                    cancelButtonText: this.$t("message.cancel"),
                    type: "warning"
                }
            ).then(
                () => {
                    const ids = [];
                    if (_.isArray(obj)) {
                    } else {
                        ids.push(obj.id);
                    }
                    API.batchDelCultureScheme(ids).then(res => {
                        if (res && res.code === 200) {
                            this.$notify.success({
                                title: "成功",
                                message: "删除成功！"
                            });
                        }
                        this.onSubmit();
                    });
                },
                () => {}
            );
        },
        handleExamineScheme(item) {
            this.schemeInfo = item;
            this.examineInfo.id = item.id;
            this.examineVisible = true;
        },
        handleAvatarPreview() {},
        handleAvatarRemove(file, fileList) {
            this.examineFileList = fileList;
            this.examineInfo.evidenceList = _.map(fileList, "name");
        },
        handleUploadSuccess(res, file, fileList) {
            this.examineFileList = fileList;
            this.examineInfo.evidenceList = _.map(fileList, item => {
                return item.response.data[item.name].objectkey;
            });
        },
        addButton() {
            this.addFormVisible = true;
        },
        clearAddCultureSchemeForm(props) {
            _.each(props, prop => {
                this.addCultureSchemeForm[prop] = "";
            });
        },
        submitExamine() {
            if (
                this.examineFileList.length === 0 ||
                this.examineInfo.editExplain === ""
            ) {
                this.$message({
                    message: "材料说明和证明材料不能为空！",
                    type: "warning"
                });
                return;
            }

            API.checkCultureScheme(this.examineInfo).then(res => {
                if (res && res.code !== 200) {
                    this.$message({
                        message: res.msg,
                        type: "warning"
                    });
                    return;
                }
                this.examineVisible = false;
                this.examineInfo.editExplain = "";
                this.examineFileList = [];
                this.$message({
                    message: "提交审核成功！",
                    type: "success"
                });
                this.handleSearch();
            });
        },
        resetExamine() {
            this.examineInfo.evidenceList = [];
            this.examineInfo.editExplain = "";
            this.examineFileList = [];
            this.examineVisible = false;
        },
        submitForm(formName) {
            this.$refs[formName].validate(valid => {
                if (valid) {
                    API.addCultureScheme(this.cultrueScheme).then(res => {
                        if (res && res.code === 200) {
                            this.addFormVisible = false;
                            this.$notify.success({
                                title: "成功",
                                message: "培养方案创建成功！"
                            });
                            this.handleSearch();
                            return;
                        }
                        if (res && res.code === 300) {
                            this.alertTitle = "培养方案名称不能重复！";
                            this.showAlert = true;
                        }
                    });
                } else {
                    return false;
                }
            });
        },
        resetForm(formName) {
            this.$refs[formName].resetFields();
            this.addFormVisible = false;
        },
        copyScheme(item) {
            API.findCultureSchemeById({
                id: item.id
            }).then(res => {
                this.cultrueScheme = res.data;
                this.addFormVisible = true;
            });
        },
        closeAlert() {
            this.showAlert = false;
        },
        handleEditItem(item) {
            // this.$router.push(
            //     "/cultureSchemeDetail/" + item.id + "/" + item.projId
            // );
            this.$router.push({
                path: "/cultureSchemeDetail/" + item.id + "/" + item.projId,
                query: {
                    templateId: item.templateId
                }
            });
        },
        sendChangeRequest(item) {
            if (item) {
                this.curItem = item;
                this.showSendChangeRequestDialog = true;
                return;
            } else {
                if (!this.curItem) return;
                let params = {
                    id: this.curItem.id,
                    isSynchronousPlan: this.isSynchronousPlan
                };
                API.changeCultureScheme(params).then(res => {
                    if (res.code == 200) {
                        this.onSubmit();
                        this.showSendChangeRequestDialog = false;
                        this.$router.push(
                            "/cultureSchemeDetail/" +
                                res.data.id +
                                "/" +
                                this.curItem.projId
                        );
                    }
                });
            }
        },
        handleViewItem(item) {
            this.$router.push(
                "/cultureSchemeDetail/" + item.id + "/" + item.projId
            );
        },
        handleResetItem(item){
            console.log(item)
             API.rejectApprove(item.id).then(res => {
                if (res && res.code === 200) {
                    this.$notify.success({
                        title: "成功",
                        message: "撤销成功！"
                    });
                }
                this.handleSearch();
            });
        },
        selectionChange(selection) {
            const self = this;
            self.multipleSelection = selection;
        },
        handleExportSchemes(language) {
            const ids = _.map(this.multipleSelection, "id");
            if (ids.length === 0) {
                this.$notify.warning({
                    title: "提示",
                    message: "您还没有选择任何方案！"
                });
                return;
            }
            const str = ids.join(",");
            const params = {
                cultureIds: str,
                language,
                "x-token":
                    this.$store.state.session.sessionid ||
                    localStorage.getItem("sessionid") ||
                    ""
            };
            API.schemeListExport(params);
        },
        handleDeleteSchemes() {
            const ids = _.map(this.multipleSelection, "id");
            if (ids.length === 0) {
                this.$notify.warning({
                    title: "提示",
                    message: "您还没有选择任何方案！"
                });
                return;
            }
            const idx = this.multipleSelection.findIndex(
                e => e.status * 1 == 2
            );
            if (idx > -1) {
                this.$notify.warning({
                    title: "提示",
                    message: "所选列表方案状态中存在审核中状态,暂不支持删除!"
                });
                return;
            }
            this.$confirm("确认删除所选列表方案,是否继续?", "提示", {
                confirmButtonText: "确认",
                cancelButtonText: "取消",
                closeOnClickModal: false,
                closeOnPressEscape: false,
                type: "warning"
            })
                .then(() => {
                    API.batchDelCultureScheme(ids).then(res => {
                        if (res && res.code === 200) {
                            this.$notify.success({
                                title: "成功",
                                message: "删除成功！"
                            });
                        }
                        this.onSubmit();
                    });
                })
                .catch(err);
        },
        handleBatchCreateSchemes() {
            this.batchCreateSchemesVisible = true;
        },
        batchCultrueSchemeReset(formName) {
            this.$refs[formName].resetFields();
            this.batchCreateSchemesVisible = false;
        },
        batchCultrueSchemeSubmit(formName) {
            this.$refs[formName].validate(valid => {
                if (valid) {
                    this.batchCultrueScheme.projId = this.queryForm.projId;
                    let batchCultrueSchemeCopy = JSON.parse(
                        JSON.stringify(this.batchCultrueScheme)
                    );
                    if (batchCultrueSchemeCopy.faculty.length === 0) {
                        batchCultrueSchemeCopy.faculty = this.options.faculty.map(
                            item => item.value
                        );
                    } else {
                        if (batchCultrueSchemeCopy.major.length === 0) {
                            batchCultrueSchemeCopy.major = this.options.batchCultrueSchemeMajor.map(
                                item => item.value
                            );
                        }
                    }
                    batchCultrueSchemeCopy.faculty = batchCultrueSchemeCopy.faculty.join(
                        ","
                    );
                    batchCultrueSchemeCopy.major = batchCultrueSchemeCopy.major.join(
                        ","
                    );
                    API.batchAddCultureScheme(batchCultrueSchemeCopy).then(
                        res => {
                            if (res && res.code === 200) {
                                this.batchCreateSchemesVisible = false;
                                this.showBatchCreateResultDialog = true;
                                this.result.msg =
                                    "由于培养方案批量创建数据量大，正在处理中，可稍等10分钟后刷新页面或前往公共导出页面查看批量创建培方案情况表格。";
                                this.handleSearch();
                                this.$refs[formName].resetFields();
                            }
                        }
                    );
                } else {
                    return false;
                }
            });
        },
        resetAddForm() {
            this.$refs.addCultureSchemeForm.resetFields();
        },
        getDepartment(){//判断培养方案类型
            let currentId = (this.$store.state.session && this.$store.state.session.user) || JSON.parse(localStorage.getItem("user"));
            if (currentId.currentManageDptId === "1") {
                return {
                    department : "本科生培养方案",
                    departmenEn:'Undergraduate culture scheme'
                }
            } else {
                return {
                    department : "研究生培养方案",
                    departmenEn:'Postgraduate culture scheme'
                }
            }
        },
        autoName() {
            if (!this.autoNameIsChecked) return;
            const form = this.addCultureSchemeForm;
            if (
                form.templateId &&
                form.faculty &&
                (form.major || form.campusProfession)
            ) {
                const faculty = this.getlabelFromOptions(
                    "faculty",
                    form.faculty
                );
                const major =
                    this.queryForm.projId == "1"
                        ? this.getlabelFromOptions(
                              "campusProfessions",
                              form.campusProfession
                          )
                        : this.getlabelFromOptions("major", form.major);
                const template = this.getlabelFromOptions(
                    "templates",
                    form.templateId
                );
                let getTrainingLevelPromise = findDictByCondition({
                    type: "X_PYCC",
                    code: form.trainingLevel
                });
                let getTrainingCategoryPromise = findDictByCondition({
                    type: "X_PYLB",
                    code: form.trainingCategory
                });
                let getFacultyPromise = findDictByCondition({
                    type: "X_YX",
                    code: form.faculty
                });
                let getMajorPromise = findDictByCondition({
                    type: "G_ZY",
                    code: form.major || form.campusProfession
                });
                let that = this
                Promise.all([getTrainingLevelPromise,getTrainingCategoryPromise,getFacultyPromise, getMajorPromise]).then(function(
                    data
                ) {
                    console.log(data)
                    let [trainingLevel,trainingCategory,faculty, major] = data;
                    let trainingLevelEn = "";
                    let trainingCategoryEn = "";
                    let trainingLevelCn = "";
                    let trainingCategoryCn = "";
                    let facultyEn = "";
                    let majorEn = "";
                    let facultyCn = "";
                    let majorCn = "";
                    if (trainingLevel.code === 200) {
                        trainingLevelEn = trainingLevel.data[0]
                            ? trainingLevel.data[0].nameEN
                            : trainingLevelEn;
                        trainingLevelCn = trainingLevel.data[0]
                            ? trainingLevel.data[0].nameCN
                            : trainingLevelCn;    
                    }
                    if (trainingCategory.code === 200) {
                        trainingCategoryEn = trainingCategory.data[0]
                            ? trainingCategory.data[0].nameEN
                            : trainingCategoryEn;
                        trainingCategoryCn = trainingCategory.data[0]
                            ? trainingCategory.data[0].nameCN
                            : trainingCategoryCn;    
                    }
                    if (faculty.code === 200) {
                        facultyEn = faculty.data[0]
                            ? faculty.data[0].nameEN
                            : facultyEn;
                        facultyCn = faculty.data[0]
                            ? faculty.data[0].nameCN
                            : facultyCn;    
                    }
                    if (major.code === 200) {
                        majorEn = that.curChangeList[0].nameEn ? that.curChangeList[0].nameEn : '';
                        majorCn = that.curChangeList[0].name ? majorCn = that.curChangeList[0].name : '';
                        // majorEn = major.data[0]
                        //     ? major.data[0].nameEN
                        //     : majorEn;
                        // majorCn = major.data[0]
                        //     ? major.data[0].nameCN
                        //     : majorCn;    
                    }
                    let professionCode =
                    that.queryForm.projId == "1"
                        ? form.campusProfession
                        : form.major;
                    const grade = form.grade;
                    let {department,departmenEn}=that.getDepartment();
                    form.name = `${grade}级 ${facultyCn}/${majorCn}(${professionCode}) ${trainingCategoryCn} ${trainingLevelCn}${department}`;
                    form.nameEn = `${grade}/${facultyEn}-${majorEn}(${professionCode}) ${trainingCategoryEn} ${trainingLevelEn}${departmenEn}`;
                });
            }
        },
        exportPage(){
            let data = _.cloneDeep(this.queryForm);
            let ids = this.multipleSelection.map(item=>item.id);
            data.trainingCategory = this.queryForm.trainingCategory+'';
            data.ids =ids+"";
            API.exportPage(data);
        }
    }
};
</script>
<style scoped>
    .div-main {
        margin-bottom: 16px;
    }
</style>
